Skip to content

Fix bug with "TypeError: fore|back|style() takes no arguments - #13

Closed
Arinffy wants to merge 1 commit into
petercorke:masterfrom
Arinffy:master
Closed

Fix bug with "TypeError: fore|back|style() takes no arguments#13
Arinffy wants to merge 1 commit into
petercorke:masterfrom
Arinffy:master

Conversation

@Arinffy

@Arinffy Arinffy commented Dec 7, 2024

Copy link
Copy Markdown

Dear Mr. Corke,

I hope this letter finds you well.

I wanted to inform you that I am currently using a system with Docker-ubuntu20.04 and Python 3.8.5. I am incredibly grateful for your open-source project, roboticstoolbox-python, which I have been diligently studying.

Furthermore, I recently encountered an issue and debugged the fore|back|style errors. I discovered that for known and definite rendering effects, such as text, one can set the color in the form of fore.GREEN. However, for unknown and dynamic content, it is necessary to use fg(set). If this modification is not made, an error occurs when printing (robot). So far, I have not encountered any other anomalies.

If you have any questions or concerns regarding this matter, please do not hesitate to reach out to me via email at Arinffy@outlook.com.

Thank you once again for your valuable contributions to the open-source community.

Yours sincerely,

Arinffy

…rguments"

I debugged the fore|back|style errors: If it's for known and definite rendering effects like text, you can set it in the form of fore.GREEN. However, for unknown and dynamic content, it needs to be set as fg(set). If this is not modified, there will be an error when printing (robot). No other anomalies have been observed.
@petercorke

Copy link
Copy Markdown
Owner

thanks for your comments. I am really confused about fg vs fore for the colored package. From its CHANGELOG:

[2.0.0] - 2023-06-19

  • Renamed functions:
    • fg() to fore()
    • bg() to back()
    • attr() to style()

then later

[2.1.1] - 2023-06-20

Changed
Restored legacy support for version 1.x.x:
Reintroduced fg(), bg(), and attr() functions (to be deprecated in future releases).

Can you give me a small runnable example that shows the problem you are experiencing.

@petercorke

Copy link
Copy Markdown
Owner

This reverts fore/back/style calls to fg/bg/attr, which is the old colored 1.x API. The project already migrated deliberately to the 2.x API (see CHANGELOG.md's 0.9.10 entry: "fix problems due to changes with colored 2.x").

I verified against the current colored 2.3.2 on PyPI that fore()/back()/style() work correctly as callables for dynamic color names — the PR author was almost certainly running an old pinned colored==1.x in their Docker/Python 3.8.5 environment, not hitting a real bug in current ansitable. Merging would reintroduce a regression for everyone on the currently-supported colored version.

@petercorke petercorke closed this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants